package com.example.administrator.meishi.adapter;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.example.administrator.meishi.fragment.FragmentHOT;
import com.example.administrator.meishi.utils.PATH;

public class ProjectPagerAdapter extends FragmentPagerAdapter {
    //fragment工厂
    private static String[] titles = {"热门", "搞笑", "美妆", "美食","吃秀", "音乐", "舞蹈", "宝宝","明星", "女神", "涨姿势", "宠物","男神", "逛拍"};

    public ProjectPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        Fragment fragment = null;
        Bundle bundle = null;
        switch (position) {
            case 0:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.HOT);
                fragment.setArguments(bundle);
                break;
            case 1:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.Happy);
                fragment.setArguments(bundle);
                break;
            case 2:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.WOMEN);
                fragment.setArguments(bundle);
                break;
            case 3:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.STAR);
                fragment.setArguments(bundle);
                break;
            case 4:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.ZY);
                fragment.setArguments(bundle);
                break;
            case 5:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.BABY);
                fragment.setArguments(bundle);
                break;
            case 6:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.DANCE);
                fragment.setArguments(bundle);
                break;
            case 7:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.EAT);
                fragment.setArguments(bundle);
                break;
            case 8:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.EAT_SHOW);
                fragment.setArguments(bundle);
                break;
            case 9:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.MUSIC);
                fragment.setArguments(bundle);
                break;
            case 10:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.PAT);
                fragment.setArguments(bundle);
                break;
            case 11:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.SH);
                fragment.setArguments(bundle);
                break;
            case 12:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.MAN);
                fragment.setArguments(bundle);
                break;
            case 13:
                fragment = new FragmentHOT();
                bundle = new Bundle();
                bundle.putString("pos",PATH.IMAN);
                fragment.setArguments(bundle);
                break;
        }
        return fragment;
    }

    @Override
    public int getCount() {
        return titles.length;
    }
    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
